import Taro, { Component } from '@tarojs/taro'
import { View, Text,Image } from '@tarojs/components'
import './paycost.css'
import {AtAvatar,AtList, AtListItem,AtButton } from 'taro-ui'
import {$navigateTo,getGlobalData} from '../../../global'
import app from '../../../main.js'
export default class PayCost extends Component {

  config = {
    navigationBarTitleText: '支付问诊费用'
  }
  constructor () {
    super(...arguments)
    this.state = {
      current: 0,
      targetPage:''
    }
  }
  handleClick (value) {
    this.setState({
      current: value
    })
  }
  selectType=(e)=>{
    e.target.parentNode.children[0].className='at-col at-col-6';
    e.target.parentNode.children[1].className='at-col at-col-6';
    e.target.className='at-col at-col-6 selected';
}
zixun=()=>{
  $navigateTo(this.state.targetPage);
}
  componentWillMount () {
      switch(this.$router.params.type){
        case 'registration':
        this.setState({
          targetPage:'../dialogend/dialogend'
        });
        break;
        default:
        this.setState({
          targetPage:'../chooseconsultation/chooseconsultation'
        });
      }
   }

  componentDidMount () { }

  componentWillUnmount () { }

  componentDidShow () { }

  componentDidHide () { }

  render () {
    return (    
      <View className='pay-cost'>
        <View className='header at-row'>
                            <View className='at-col at-col-6 selected' onClick={this.selectType.bind(this)}>在线咨询</View>
                            <View className='at-col at-col-6' onClick={this.selectType.bind(this)}>咨询记录</View>
                        </View>
        <View className='time'>17:20</View>
                        <View className='dialog'>
                            <AtAvatar className='dialog-head all-float'  circle={true}  size='small' image={getGlobalData('baseurl')+'img/d1.jpg'}></AtAvatar>
                            <View className='dialog-text all-float'>
                                <View className='hi'>你好，很高兴为你提供帮助</View>
                                <AtList className='list-box' hasBorder={false}>
                                    <AtListItem title='孙雪' extraText='擅长' arrow='right' hasBorder={false} />
                                    <AtListItem title='眼科，主治医师' hasBorder={false} />
                                    <AtListItem title='广东省第一人民人民医院' hasBorder={false} />
                                </AtList>
                            </View>
                        </View>
                        <View className='tips'>温馨提示：在线咨询不能作为诊断依据</View>
          <View className='footer'>
            <View className='pay at-row at-row__justify--between'>
                <Text className='p-title at-col at-col-1 at-col--auto'>应付金额</Text>
                <Text className='p-money at-col at-col-1 at-col--auto'>￥700.00</Text>
            </View>
            <View className='tips tips-two'><Image className='yes-img' src={getGlobalData('baseurl')+'img/dagou.png'}></Image>如不满意，全额退款</View>
            <View className='consult-box'><AtButton onClick={this.zixun} className='next-btn'>立即咨询</AtButton></View>
          </View>   
      </View>
    )
  }
}

